package lsp

// 行为

// 采集 收藏
type ImmutableCollection interface {
    Get(index int) interface{}
}
type MutableCollection interface {
    ImmutableCollection
    Add(item interface{})
}

type ReadOnlyCollectionV2 struct {
    items []interface{}
}

func (ro *ReadOnlyCollectionV2) Get(index int) interface{} {
    return ro.items[index]
}

type CollectionImpV2 struct {
    ReadOnlyCollectionV2
}

func (c *CollectionImpV2) Add(item interface{}) {
    c.items = append(c.items, item)
}
